<?php
namespace app\backstage\validate;
use think\Validate;

class CostManual extends Validate
{
    protected $rule = [
        'channel_id'    => 'require|gt:0',
        'money'         => 'require|gt:0',
        'id'            => 'require|gt:0',
        'advert_media_id'   => 'require|gt:0',
        'cost_date'         => 'require',
        'link_id'           => 'require|gt:0',
    ];

    protected $message  =   [
        'id.require'            => '信息记录ID不能为空',
        'id.gt'                 => '信息记录ID不能为空',
        'channel_id.require'    => '请选择关联投放号',
        'channel_id.gt'         => '请选择关联投放号',
        'money.require'         => '消耗金额不能为空',
        'money.gt'              => '消耗金额不能为空',
        'advert_media_id.require' => '请选择投放媒体',
        'advert_media_id.gt'      => '请选择投放媒体',
        'cost_date.require'       => '请选择消耗日期',
        'link_id.require'         => '请选择推广链接',
        'link_id.gt'              => '请选择推广链接',
    ];

    protected $scene = [
        'add_agent1'    => ['channel_id','money','cost_date'],
        'add_agent2'    => ['channel_id','advert_media_id','money','cost_date'],
        'add_agent3'    => ['channel_id','link_id','money','cost_date'],
        'add1'          => ['money','cost_date'],
        'add2'          => ['advert_media_id','money','cost_date'],
        'add3'          => ['link_id','money','cost_date'],
        'edit_agent1'    => ['id','channel_id','money','cost_date'],
        'edit_agent2'    => ['id','channel_id','advert_media_id','money','cost_date'],
        'edit_agent3'    => ['id','channel_id','link_id','money','cost_date'],
        'edit1'          => ['id','money','cost_date'],
        'edit2'          => ['id','advert_media_id','money','cost_date'],
        'edit3'          => ['id','link_id','money','cost_date'],
        'info'          => ['id']
    ];
}